<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改文档分类 - 文档管理系统</title>
    <link rel="stylesheet" href="/css/style.css">
    <style>
        .document-info {
            margin-bottom: 20px;
        }
        .document-info h3 {
            margin-top: 0;
            margin-bottom: 10px;
            color: #333;
        }
        .document-info p {
            margin: 5px 0;
            color: #666;
        }
        .document-info strong {
            font-weight: bold;
            color: #333;
        }
        .form-group {
            margin-bottom: 20px;
        }
        .form-control {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
        }
        .form-actions {
            margin-top: 20px;
            display: flex;
            gap: 10px;
        }
        
        /* 仅为分类选择器添加科技风格 */
        #categoryId {
            width: 100%;
            padding: 12px 15px;
            background: linear-gradient(145deg, rgba(10, 20, 40, 0.6), rgba(20, 40, 70, 0.7));
            border: 1px solid rgba(30, 140, 255, 0.4);
            border-radius: 8px;
            color: #ffffff;
            font-size: 15px;
            transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
            box-shadow: 0 2px 10px rgba(0, 100, 255, 0.1), 
                        inset 0 1px 2px rgba(255, 255, 255, 0.1);
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            cursor: pointer;
            background-image: 
                linear-gradient(145deg, rgba(10, 20, 40, 0.6), rgba(20, 40, 70, 0.7)),
                url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2340a9ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 15px center;
            background-size: auto, 16px;
            padding-right: 40px;
        }
        
        #categoryId:focus {
            outline: none;
            border-color: rgba(0, 170, 255, 0.8);
            box-shadow: 0 0 15px rgba(0, 150, 255, 0.3),
                        inset 0 1px 2px rgba(255, 255, 255, 0.2);
        }
        
        #categoryId:hover {
            border-color: rgba(30, 180, 255, 0.8);
            box-shadow: 0 5px 15px rgba(0, 120, 255, 0.2),
                        inset 0 1px 2px rgba(255, 255, 255, 0.2);
        }
        
        #categoryId option {
            background-color: rgba(10, 30, 60, 0.95);
            color: rgba(200, 230, 255, 0.9);
            padding: 10px;
        }
    </style>
</head>
<body>
    <div class="dashboard-container">
        <div class="sidebar">
            <div class="sidebar-header">
                <h2>控制面板</h2>
            </div>
            <ul class="sidebar-menu">
                <li><a href="/dashboard">主页</a></li>
                <li><a href="/dashboard/profile">个人信息</a></li>
                <li><a href="/dashboard/change-password">修改密码</a></li>
                <li class="active"><a href="/dashboard/documents">文档管理</a></li>
                <li><a href="/dashboard/categories">分类管理</a></li>
                <li><a href="/dashboard/weblinks">网站链接管理</a></li>
                <li><a href="/dashboard/users">用户管理</a></li>
                <li><a href="/danmaku-display">弹幕墙</a></li>
                <li><a href="/" target="_blank">访问首页</a></li>
                <li><a href="/logout">退出登录</a></li>
            </ul>
        </div>
        
        <div class="main-content">
            <div class="dashboard-header">
                <div class="dashboard-title">
                    <h1>修改文档分类</h1>
                </div>
            </div>
            
            <div class="alert alert-success" th:if="${successMessage}">
                <p th:text="${successMessage}"></p>
            </div>
            
            <div class="alert alert-danger" th:if="${errorMessage}">
                <p th:text="${errorMessage}"></p>
            </div>
            
            <div class="card">
                <div class="card-header">
                    <h2>文档信息</h2>
                </div>
                <div class="card-body">
                    <div class="document-info">
                        <h3 th:text="${document.title}">文档标题</h3>
                        <p><strong>作者：</strong> <span th:text="${document.author}">作者</span></p>
                        <p><strong>创建时间：</strong> <span th:text="${#temporals.format(document.createdAt, 'yyyy-MM-dd HH:mm')}">创建时间</span></p>
                        <p><strong>更新时间：</strong> <span th:text="${#temporals.format(document.updatedAt, 'yyyy-MM-dd HH:mm')}">更新时间</span></p>
                        <p><strong>当前分类：</strong> <span th:text="${document.category != null ? document.category.name : '无分类'}">分类</span></p>
                    </div>
                </div>
            </div>
            
            <div class="card mt-4">
                <div class="card-header">
                    <h2>选择新分类</h2>
                </div>
                <div class="card-body">
                    <form th:action="@{/dashboard/documents/change-category/{id}(id=${document.id})}" method="post">
                        <div class="form-group">
                            <label for="categoryId">分类</label>
                            <select id="categoryId" name="categoryId" class="form-control">
                                <option value="">-- 无分类 --</option>
                                <option th:each="cat : ${categories}" 
                                        th:value="${cat.id}" 
                                        th:text="${cat.name}"
                                        th:selected="${document.category != null && document.category.id == cat.id}">
                                </option>
                            </select>
                        </div>
                        <div class="form-actions">
                            <button type="submit" class="btn btn-primary">保存修改</button>
                            <a th:href="@{/dashboard/documents}" class="btn btn-secondary">返回列表</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    
    <script src="/js/script.js"></script>
</body>
</html> 